<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?php
  $myTitel = formatTitel($pageData->titel); 
  $myBgImage = rawurlencode($pageData->bgImage);
?>
<html>

<head>
	<title><?=niceTitel($pageData->titel)?></title>
	<LINK REL="stylesheet" TYPE="text/css" HREF="style/kabelkrant.css">
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
	<script src="script/narrowcast.js"></script>
	<script language='javascript'>
		function nextpage() {
			self.location.href = "kabelkrant.php?command=run&page=<?=$pageData->nextpage?>";
		}
	</script>
<?php // if ($pageData->command == "preview") { ?>
<style>
	body {
		background: url(images/<?=$myBgImage?>) no-repeat scroll 0% 0% / cover transparent;
		background-size: cover;
	}
</style>
<?php //} ?>
</head>

<body>


<?php if ($myTitel != "") { echo "<h1>$myTitel</h1>"; } ?>

<p>
<?php

if (!isset($pageData->inhoud)) {
	$pageData->inhoud = "";
} 
if ($pageData->inhoud == "" && !isset($pageData->dur)) {
	$pageData->pauze = $pageData->pauze / 2;
}

$pageData->inhoud = str_replace("[euro]", "<font face=Arial>&euro;</font>", $pageData->inhoud);

$lines = explode("<br>", $pageData->inhoud);
$inTabel = false;
foreach ($lines as $line) {
	if (strpos($line, "~") !== false) {
		if (!$inTabel) {
			echo '<table class="tilde-tabel">';
			$inTabel = true;
		}
		echo "<tr>";
		foreach (explode("~", $line) as $cell) {
			echo "<td>$cell</td>";
		}
		echo "</tr>\n";
	} else {
		if ($inTabel) {
			echo '</table>';
			$inTabel = false;
		}
		echo "$line<br>\n";
	}
}
if ($inTabel) {
	echo '</table>';
	$inTabel = false;
}
?>
</p>

<?php if ($pageData->command != "preview") { ?>
<script language="JavaScript">
	setTimeout('nextpage()', <?=$pageData->pauze * 1000?>);
</script>
<?php } else { ?>
<div style="position: absolute; visibility: visible; top: 10px; left: 10px; zoom: 2"><input type="button" value="Klaar met voorbeeld" onclick="self.close();"></div>
&nbsp;
<?php } ?>

<span id="clock" name="clock" class="underline"></span>

<?php if ($pageData->titel != "") { ?>
<script language="JavaScript">
	showtime();
</script>
<?php } ?>

</body>
</html>
